﻿using System;
using System.Globalization;
using System.Windows.Data;
using Labthink.PCSoft.UniversalHost4.Utility;

namespace Labthink.PCSoft.UniversalHost4.Instrument.Converters
{
    public class AddOrShowTagConverter:IValueConverter
    {
      
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null || string.IsNullOrEmpty(value+"")) return LanguageManager.GetLanguageValue("Tag");
            var str = value + "";
            if (str.Length < 8) return str;
            return str.Substring(0, 7) + "...";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
